<template>
  <a-layout-header class="header">
    <span class="title">Code-Pulse | 团队选择</span>
  </a-layout-header>
  <div class="flex-center margin-top-10">
    <a-spin v-if="isLoading"></a-spin>
    <template v-else>
      <div v-if="dataList?.length > 0" class="content-select">
        <team-select :team-list="dataList" />
      </div>
      <div class="content-select" v-else>
        <add-team />
      </div>
    </template>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { listSelfTeamApi } from '@/api/system/team'
import AddTeam from '@/views/system/team/AddTeam.vue'
import TeamSelect from '@/views/system/team/TeamSelect.vue'
const isLoading = ref(true)
const dataList = ref([])
const getSelfTeamList = async () => {
  try {
    const res = await listSelfTeamApi()
    dataList.value = res.data
  } finally {
    isLoading.value = false
  }
}
onMounted(() => {
  getSelfTeamList()
})
</script>

<style scoped lang="scss">
.header {
  width: 100%;
  height: 60px;
  background-image: linear-gradient(179deg, #e9fbff 0%, #f3f5ff 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0px 10px;
}
.title {
  font-size: 20px;
  font-weight: bold;
}
.box-card {
  width: 400px;
  height: 300px;
  z-index: 2;
}
.content-select {
  display: flex;
  align-items: center;
  justify-content: center;
  .card {
    min-width: 800px;
    margin-top: 50px;
  }
}
</style>
